class EndScene extends Scene {
	private score:eui.Label;
	private wrong:eui.Label;
	private no:eui.Label;
	private btnReStart: eui.Button;
	private music: eui.Button;
	private historyScore: eui.Label;

	public constructor() {
		super();
		this.skinName = "resource/eui_skins/myskins/EndScene.exml";
		this.addEventListener(egret.Event.ADDED_TO_STAGE , this.onAddToStage , this);
	}
	protected createChildren(){
		super.createChildren();
		this.addEventListener(egret.Event.ADDED_TO_STAGE , this.rotateLogo , this);
	}

	private onAddToStage(){
		// this.music.rotation = MusicManager.Instance.getRotate();
		// 写入信息到场景中
		this.score.text  = QuestionManager.Instance.GetScore().score.toString();
		this.wrong.text = QuestionManager.Instance.GetScore().wrong.toString();
		this.no.text = QuestionManager.Instance.GetScore().no.toString();
		this.historyScore.text = egret.localStorage.getItem("localScore");
		//监听重新开始
		this.btnReStart.addEventListener(egret.TouchEvent.TOUCH_TAP , this.reStart , this);
		// this.music.addEventListener(egret.TouchEvent.TOUCH_TAP,(e:egret.TouchEvent)=>{
		// 	MusicManager.Instance.onTouch();
		// },this);
	}
	// 重新开始游戏按钮
	private reStart():void{
		SceneManager.Instance.changeScene(Main.beginScene);
		MusicManager.Instance.rotateFlag = true;
	}

	private rotateLogo(){
		if(this.music){
			this.music.rotation = MusicManager.Instance.getRotate();
		}
	}
}